package com.etoak.config.mvc;

import com.etoak.filter.CrossDomainFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.CrossOrigin;

/**
 * @Author by 孙有泽
 * @Date 2024/12/6 15:13
 * @Description : 跨域配置
 */
@Configuration
public class CrossDomainConfig {
    @Bean
    public FilterRegistrationBean<CrossDomainFilter> crossDomainFilterBean() {
        FilterRegistrationBean<CrossDomainFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new CrossDomainFilter());
        registration.addUrlPatterns("/*");
        registration.setOrder(-100);
        return registration;
    }
}
